package com.example.booksystem.Result;

import com.example.booksystem.constant.Constant;
import com.example.booksystem.model.BookInfo;
import com.example.booksystem.model.PageResult;
import lombok.Data;

@Data
public class Result <T>{
    private ResultCodeEnum code;
    private String srroeMessage;
    private T data;

    public static <T> Result<T> nologin(){
        Result result = new Result<>();
        result.setCode(ResultCodeEnum.NOLOGIN);
        result.setSrroeMessage("用户未登录");
        return result;
    }

    public static <T> Result<T>success(T data){
        Result result = new Result<>();
        result.setCode(ResultCodeEnum.SUCCESS);
        result.setData(data);
        return result;
    }

    public static <T> Result<T>fail(String errMsg){
        Result result = new Result<>();
        result.setSrroeMessage(errMsg);
        result.setCode(ResultCodeEnum.FATL);
        result.setData(null);
        return result;
    }




}
